package tk.xboot.boot.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;

@RestController
@RequestMapping("idx")
public class IndexController {


    public String getIdxPage(){
        return "idx";
    }

    @Value("${idx.desc}")
    private String desc;

    @GetMapping("desc")
    public Object getDesc(){
        return desc;
    }


    @GetMapping("async")
    public Callable<String> async(){
        return ()->"async : Hello.";
    }

    @GetMapping("async_map")
    public Callable<Map> asyncMap(){
        Map map = new HashMap();
        map.put("code", "x");
        map.put("value", 1111);
        return ()->map;
    }
}
